import os

path = 'file.txt'

abspath = os.path.abspath(path)

print(
  os.path.abspath(path),
  os.path.dirname(abspath),
)

print(
  os.path.basename(path),
  os.path.basename(abspath),
)

print(
  os.path.splitext(path)[0],
  os.path.splitext(path)[1],
  os.path.splitext(os.path.basename(path))[0],
  os.path.splitext(os.path.basename(path))[1],
  os.path.splitext(abspath)[0],
  os.path.splitext(abspath)[1],
)

